﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Audio;

namespace FierceWar
{
	public class GameResources
	{
		// Graphics.
		public GraphicsDevice GraphicsDevice;
		public SpriteBatch SpriteBatch;

		// Content manager.
		public ContentManager Content;

		// Game window.
		public GameWindow Window;

		// Fonts.
		public SpriteFont MenuFont;
		public SpriteFont BuildMapHelpFont;
		public SpriteFont AboutTitleFont;
		public SpriteFont AboutBodyFont;
		public SpriteFont LoadingFont;
		public SpriteFont PauseFont;
		public SpriteFont FigureFont;

		// Textures.
		public Texture2D BlankTexture;
		public Texture2D BackgroundTexture;
		public Texture2D LoadPlayingScreen;
		public Texture2D LoadCreateMapScreen;
		public Texture2D LoadEditMapScreen;
		public Texture2D Board1;
		public Texture2D Board2;
		public Texture2D Board3;
		public Texture2D HeathBar;
		public Texture2D Crosshairs;

		// Sound.
		public List<Song> MainMenuBackground;
		public Song BuildMapBackground;
		public Song PlayingBackground;
		public SoundEffect BuildingPlacement;
		public SoundEffect BuildingDestruction;
		public SoundEffect MenuHover;
		public SoundEffect MenuClick;
		public SoundEffect Hit;
		public SoundEffect Explode;
		public SoundEffect LevelUp;
		public SoundEffect Charge;
		public SoundEffectInstance ChargeInstance;

		public GameResources(GraphicsDevice graphicsDevice, GameWindow window,
			SpriteBatch spriteBatch, ContentManager content)
		{
			// Graphics.
			GraphicsDevice = graphicsDevice;
			SpriteBatch = spriteBatch;

			// Game window.
			Window = window;

			// Content manager.
			Content = content;

			// Fonts.
			MenuFont = Content.Load<SpriteFont>("Font/MenuFont");
			BuildMapHelpFont = Content.Load<SpriteFont>("Font/BuildMapHelpFont");
			AboutTitleFont = Content.Load<SpriteFont>("Font/AboutTitleFont");
			AboutBodyFont = Content.Load<SpriteFont>("Font/AboutBodyFont");
			LoadingFont = Content.Load<SpriteFont>("Font/LoadingFont");
			PauseFont = Content.Load<SpriteFont>("Font/PauseFont");
			FigureFont = Content.Load<SpriteFont>("Font/FigureFont");

			// Textures.
			BlankTexture = Content.Load<Texture2D>("Image/Blank");
			BackgroundTexture = Content.Load<Texture2D>("Image/Background");
			LoadPlayingScreen = Content.Load<Texture2D>("Image/LoadPlayingScreen");
			LoadCreateMapScreen = Content.Load<Texture2D>("Image/LoadCreateMapScreen");
			LoadEditMapScreen = Content.Load<Texture2D>("Image/LoadEditMapScreen");
			Board1 = Content.Load<Texture2D>("Image/Board1");
			Board2 = Content.Load<Texture2D>("Image/Board2");
			Board3 = Content.Load<Texture2D>("Image/Board3");
			HeathBar = Content.Load<Texture2D>("Image/HeathBar");
			Crosshairs = Content.Load<Texture2D>("Image/Crosshairs");

			// Sound.
			MainMenuBackground = new List<Song>() {
						Content.Load<Song>("Sound/MainMenuBackground1"),
						Content.Load<Song>("Sound/MainMenuBackground2"),
						Content.Load<Song>("Sound/MainMenuBackground3"),
			};
			BuildMapBackground = Content.Load<Song>("Sound/BuildMapBackground");
			PlayingBackground = Content.Load<Song>("Sound/PlayingBackground");
			BuildingPlacement = Content.Load<SoundEffect>("Sound/BuildingPlacement");
			BuildingDestruction = Content.Load<SoundEffect>("Sound/BuildingDestruction");
			MenuHover = Content.Load<SoundEffect>("Sound/MenuHover");
			MenuClick = Content.Load<SoundEffect>("Sound/MenuClick");
			Hit = Content.Load<SoundEffect>("Sound/Hit");
			Explode = Content.Load<SoundEffect>("Sound/Explode");
			LevelUp = Content.Load<SoundEffect>("Sound/LevelUp");
			Charge = Content.Load<SoundEffect>("Sound/Charge");
			ChargeInstance = Charge.CreateInstance();
		}
	}
}
